namespace QMVnSoft.ReportForms
{
    using QMVnSoft;
    using QMVnSoft.Controls;
    using QMVnSoft.DAL;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormKTH03EViewer : FormReportViewer
    {
        private IContainer components;
        private LabelControl lblKieu_BC;
        private LabelControl lblKieu_BC0;
        private LabelControl lblKieu_Gia;
        private LabelControl lblKieu_Gia0;
        private LabelControl lblLay_DD;
        private LabelControl lblLay_DD0;
        private LabelControl lblMa_Sp;
        private LabelControl lblMa_Sp_Me;
        private LabelControl lblNgay_Ct1;
        private LabelControl lblNgay_Ct2;
        private TextOption txtKieu_BC;
        private TextOption txtKieu_Gia;
        private TextOption txtLay_DD;
        private TextSearch txtMa_Sp;
        private TextSearch txtMa_Sp_Me;
        private TextDate txtNgay_Ct1;
        private TextDate txtNgay_Ct2;
        private TextControl txtTen_Sp;
        private TextControl txtTen_Sp_Me;

        public FormKTH03EViewer()
        {
            this.InitializeComponent();
            this.txtNgay_Ct1.Value = AppInstance.StartWorkingDate;
            this.txtNgay_Ct2.Value = AppInstance.EndWorkingDate;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            //ComponentResourceManager manager = new ComponentResourceManager(typeof(FormKTH03EViewer));
            this.txtTen_Sp = new TextControl();
            this.txtMa_Sp = new TextSearch();
            this.lblMa_Sp = new LabelControl();
            this.txtTen_Sp_Me = new TextControl();
            this.txtMa_Sp_Me = new TextSearch();
            this.lblMa_Sp_Me = new LabelControl();
            this.txtNgay_Ct2 = new TextDate();
            this.lblNgay_Ct2 = new LabelControl();
            this.txtNgay_Ct1 = new TextDate();
            this.lblNgay_Ct1 = new LabelControl();
            this.lblKieu_BC0 = new LabelControl();
            this.txtKieu_BC = new TextOption();
            this.lblKieu_BC = new LabelControl();
            this.lblKieu_Gia = new LabelControl();
            this.txtKieu_Gia = new TextOption();
            this.lblKieu_Gia0 = new LabelControl();
            this.lblLay_DD = new LabelControl();
            this.txtLay_DD = new TextOption();
            this.lblLay_DD0 = new LabelControl();
            base.rptContainer.Panel1.SuspendLayout();
            base.rptContainer.SuspendLayout();
            base.SuspendLayout();
            base.rptContainer.Panel1.Controls.Add(this.lblLay_DD0);
            base.rptContainer.Panel1.Controls.Add(this.lblKieu_Gia0);
            base.rptContainer.Panel1.Controls.Add(this.lblKieu_BC0);
            base.rptContainer.Panel1.Controls.Add(this.txtLay_DD);
            base.rptContainer.Panel1.Controls.Add(this.lblLay_DD);
            base.rptContainer.Panel1.Controls.Add(this.txtKieu_Gia);
            base.rptContainer.Panel1.Controls.Add(this.lblKieu_Gia);
            base.rptContainer.Panel1.Controls.Add(this.txtKieu_BC);
            base.rptContainer.Panel1.Controls.Add(this.lblKieu_BC);
            base.rptContainer.Panel1.Controls.Add(this.txtNgay_Ct2);
            base.rptContainer.Panel1.Controls.Add(this.lblNgay_Ct2);
            base.rptContainer.Panel1.Controls.Add(this.txtNgay_Ct1);
            base.rptContainer.Panel1.Controls.Add(this.lblNgay_Ct1);
            base.rptContainer.Panel1.Controls.Add(this.txtTen_Sp_Me);
            base.rptContainer.Panel1.Controls.Add(this.txtMa_Sp_Me);
            base.rptContainer.Panel1.Controls.Add(this.lblMa_Sp_Me);
            base.rptContainer.Panel1.Controls.Add(this.txtTen_Sp);
            base.rptContainer.Panel1.Controls.Add(this.txtMa_Sp);
            base.rptContainer.Panel1.Controls.Add(this.lblMa_Sp);
            base.rptContainer.SplitterDistance = 130;
            this.txtTen_Sp.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtTen_Sp.BackColor = SystemColors.Control;
            this.txtTen_Sp.BorderStyle = BorderStyle.None;
            this.txtTen_Sp.CheckTextSearched = false;
            this.txtTen_Sp.DisabledForeColor = Color.Blue;
            this.txtTen_Sp.Enabled = false;
            this.txtTen_Sp.Font = new Font("Arial", 8.25f);
            this.txtTen_Sp.ForeColor = Color.Blue;
            this.txtTen_Sp.Location = new Point(0xd6, 0x1c);
            this.txtTen_Sp.Name = "txtTen_Sp";
            this.txtTen_Sp.OldValue = null;
            this.txtTen_Sp.Size = new Size(0x1ca, 13);
            this.txtTen_Sp.TabIndex = 90;
//            this.txtTen_Sp.Value = null;//manager.GetObject("txtTen_Sp.Value");
            this.txtMa_Sp.CharacterCasing = CharacterCasing.Upper;
            this.txtMa_Sp.CheckTextSearched = false;
            this.txtMa_Sp.DisabledForeColor = Color.Empty;
            this.txtMa_Sp.EmptyIsValid = true;
            this.txtMa_Sp.FieldDisplay = "Ten_Sp";
            this.txtMa_Sp.FirstFilter = "Loai_Sp = 'C'";
            this.txtMa_Sp.Font = new Font("Arial", 8.25f);
            this.txtMa_Sp.FoundIsValid = true;
            this.txtMa_Sp.Location = new Point(0x6c, 0x18);
            this.txtMa_Sp.MaxLength = 0x20;
            this.txtMa_Sp.Name = "txtMa_Sp";
            this.txtMa_Sp.OldValue = null;
            this.txtMa_Sp.Size = new Size(100, 20);
            this.txtMa_Sp.TabIndex = 1;
            this.txtMa_Sp.TableName = "DMSP";
            this.txtMa_Sp.TextDisplay = this.txtTen_Sp;
            this.txtMa_Sp.UserTextLength = AppInstance.TextControlLength.ItemCode;
            this.txtMa_Sp.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtMa_Sp.Value = null;//manager.GetObject("txtMa_Sp.Value");
            this.lblMa_Sp.AutoSize = true;
            this.lblMa_Sp.Font = new Font("Arial", 8.25f);
            this.lblMa_Sp.Location = new Point(12, 0x1b);
            this.lblMa_Sp.Name = "lblMa_Sp";
            this.lblMa_Sp.Size = new Size(0x37, 14);
            this.lblMa_Sp.TabIndex = 0x59;
            this.lblMa_Sp.Text = "Sản phẩm";
            this.txtTen_Sp_Me.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtTen_Sp_Me.BackColor = SystemColors.Control;
            this.txtTen_Sp_Me.BorderStyle = BorderStyle.None;
            this.txtTen_Sp_Me.CheckTextSearched = false;
            this.txtTen_Sp_Me.DisabledForeColor = Color.Blue;
            this.txtTen_Sp_Me.Enabled = false;
            this.txtTen_Sp_Me.Font = new Font("Arial", 8.25f);
            this.txtTen_Sp_Me.ForeColor = Color.Blue;
            this.txtTen_Sp_Me.Location = new Point(0xd6, 7);
            this.txtTen_Sp_Me.Name = "txtTen_Sp_Me";
            this.txtTen_Sp_Me.OldValue = null;
            this.txtTen_Sp_Me.Size = new Size(0x1ca, 13);
            this.txtTen_Sp_Me.TabIndex = 0x5f;
//            this.txtTen_Sp_Me.Value = null;//manager.GetObject("txtTen_Sp_Me.Value");
            this.txtMa_Sp_Me.CharacterCasing = CharacterCasing.Upper;
            this.txtMa_Sp_Me.CheckTextSearched = false;
            this.txtMa_Sp_Me.DisabledForeColor = Color.Empty;
            this.txtMa_Sp_Me.EmptyIsValid = true;
            this.txtMa_Sp_Me.FieldDisplay = "Ten_Sp";
            this.txtMa_Sp_Me.FirstFilter = "Loai_Sp = 'K'";
            this.txtMa_Sp_Me.Font = new Font("Arial", 8.25f);
            this.txtMa_Sp_Me.FoundIsValid = true;
            this.txtMa_Sp_Me.Location = new Point(0x6c, 3);
            this.txtMa_Sp_Me.MaxLength = 0x20;
            this.txtMa_Sp_Me.Name = "txtMa_Sp_Me";
            this.txtMa_Sp_Me.OldValue = null;
            this.txtMa_Sp_Me.Size = new Size(100, 20);
            this.txtMa_Sp_Me.TabIndex = 0;
            this.txtMa_Sp_Me.TableName = "DMSP";
            this.txtMa_Sp_Me.TextDisplay = this.txtTen_Sp_Me;
            this.txtMa_Sp_Me.UserTextLength = AppInstance.TextControlLength.ItemCode;
            this.txtMa_Sp_Me.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtMa_Sp_Me.Value = null;//manager.GetObject("txtMa_Sp_Me.Value");
            this.lblMa_Sp_Me.AutoSize = true;
            this.lblMa_Sp_Me.Font = new Font("Arial", 8.25f);
            this.lblMa_Sp_Me.Location = new Point(12, 6);
            this.lblMa_Sp_Me.Name = "lblMa_Sp_Me";
            this.lblMa_Sp_Me.Size = new Size(0x3b, 14);
            this.lblMa_Sp_Me.TabIndex = 0x5e;
            this.lblMa_Sp_Me.Text = "Công đoạn";
            this.txtNgay_Ct2.DateTimeFormat = TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct2.Font = new Font("Arial", 8.25f);
            this.txtNgay_Ct2.InsertKeyMode = InsertKeyMode.Overwrite;
            this.txtNgay_Ct2.Location = new Point(0x13c, 0x6c);
            this.txtNgay_Ct2.Mask = "00/00/0000";
            this.txtNgay_Ct2.Name = "txtNgay_Ct2";
            this.txtNgay_Ct2.OldValue = null;
            this.txtNgay_Ct2.Size = new Size(100, 20);
            this.txtNgay_Ct2.TabIndex = 6;
//            this.txtNgay_Ct2.Value = null;//manager.GetObject("txtNgay_Ct2.Value");
            this.lblNgay_Ct2.AutoSize = true;
            this.lblNgay_Ct2.Font = new Font("Arial", 8.25f);
            this.lblNgay_Ct2.Location = new Point(0x100, 0x6f);
            this.lblNgay_Ct2.Name = "lblNgay_Ct2";
            this.lblNgay_Ct2.Size = new Size(0x36, 14);
            this.lblNgay_Ct2.TabIndex = 0x61;
            this.lblNgay_Ct2.Text = "Đến ngày";
            this.txtNgay_Ct1.DateTimeFormat = TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct1.Font = new Font("Arial", 8.25f);
            this.txtNgay_Ct1.InsertKeyMode = InsertKeyMode.Overwrite;
            this.txtNgay_Ct1.Location = new Point(0x6c, 0x6c);
            this.txtNgay_Ct1.Mask = "00/00/0000";
            this.txtNgay_Ct1.Name = "txtNgay_Ct1";
            this.txtNgay_Ct1.OldValue = null;
            this.txtNgay_Ct1.Size = new Size(100, 20);
            this.txtNgay_Ct1.TabIndex = 5;
//            this.txtNgay_Ct1.Value = null;//manager.GetObject("txtNgay_Ct1.Value");
            this.lblNgay_Ct1.AutoSize = true;
            this.lblNgay_Ct1.Font = new Font("Arial", 8.25f);
            this.lblNgay_Ct1.Location = new Point(12, 0x6f);
            this.lblNgay_Ct1.Name = "lblNgay_Ct1";
            this.lblNgay_Ct1.Size = new Size(0x2f, 14);
            this.lblNgay_Ct1.TabIndex = 0x62;
            this.lblNgay_Ct1.Text = "Từ ngày";
            this.lblKieu_BC0.AutoSize = true;
            this.lblKieu_BC0.Font = new Font("Arial", 8.25f);
            this.lblKieu_BC0.ForeColor = Color.Blue;
            this.lblKieu_BC0.Location = new Point(0x89, 0x30);
            this.lblKieu_BC0.Name = "lblKieu_BC0";
            this.lblKieu_BC0.Size = new Size(240, 14);
            this.lblKieu_BC0.TabIndex = 0x65;
            this.lblKieu_BC0.Text = "1-Tổng hợp theo sản phẩm, 2-Chi tiết theo vật tư";
            this.txtKieu_BC.CharacterCasing = CharacterCasing.Upper;
            this.txtKieu_BC.CheckTextSearched = false;
            this.txtKieu_BC.DisabledForeColor = Color.Empty;
            this.txtKieu_BC.Font = new Font("Arial", 8.25f);
            this.txtKieu_BC.InputMask = "1,2";
            this.txtKieu_BC.Location = new Point(0x6c, 0x2d);
            this.txtKieu_BC.Name = "txtKieu_BC";
            this.txtKieu_BC.OldValue = null;
            this.txtKieu_BC.Size = new Size(0x17, 20);
            this.txtKieu_BC.TabIndex = 2;
            this.txtKieu_BC.Text = "1";
            this.txtKieu_BC.Value = "1";
            this.lblKieu_BC.AutoSize = true;
            this.lblKieu_BC.Font = new Font("Arial", 8.25f);
            this.lblKieu_BC.Location = new Point(12, 0x30);
            this.lblKieu_BC.Name = "lblKieu_BC";
            this.lblKieu_BC.Size = new Size(70, 14);
            this.lblKieu_BC.TabIndex = 0x63;
            this.lblKieu_BC.Text = "Kiểu báo cáo";
            this.lblKieu_Gia.AutoSize = true;
            this.lblKieu_Gia.Font = new Font("Arial", 8.25f);
            this.lblKieu_Gia.Location = new Point(12, 0x45);
            this.lblKieu_Gia.Name = "lblKieu_Gia";
            this.lblKieu_Gia.Size = new Size(0x38, 14);
            this.lblKieu_Gia.TabIndex = 0x63;
            this.lblKieu_Gia.Text = "Chi tiết giá";
            this.txtKieu_Gia.CharacterCasing = CharacterCasing.Upper;
            this.txtKieu_Gia.CheckTextSearched = false;
            this.txtKieu_Gia.DisabledForeColor = Color.Empty;
            this.txtKieu_Gia.Font = new Font("Arial", 8.25f);
            this.txtKieu_Gia.InputMask = "T,C";
            this.txtKieu_Gia.Location = new Point(0x6c, 0x42);
            this.txtKieu_Gia.Name = "txtKieu_Gia";
            this.txtKieu_Gia.OldValue = null;
            this.txtKieu_Gia.Size = new Size(0x17, 20);
            this.txtKieu_Gia.TabIndex = 3;
            this.txtKieu_Gia.Text = "T";
            this.txtKieu_Gia.Value = "T";
            this.lblKieu_Gia0.AutoSize = true;
            this.lblKieu_Gia0.Font = new Font("Arial", 8.25f);
            this.lblKieu_Gia0.ForeColor = Color.Blue;
            this.lblKieu_Gia0.Location = new Point(0x89, 0x45);
            this.lblKieu_Gia0.Name = "lblKieu_Gia0";
            this.lblKieu_Gia0.Size = new Size(0x81, 14);
            this.lblKieu_Gia0.TabIndex = 0x65;
            this.lblKieu_Gia0.Text = "C-Chi tiết giá, T-Tổng hợp";
            this.lblLay_DD.AutoSize = true;
            this.lblLay_DD.Font = new Font("Arial", 8.25f);
            this.lblLay_DD.Location = new Point(12, 90);
            this.lblLay_DD.Name = "lblLay_DD";
            this.lblLay_DD.Size = new Size(0x62, 14);
            this.lblLay_DD.TabIndex = 0x63;
            this.lblLay_DD.Text = "Sản phẩm dở dang";
            this.txtLay_DD.CharacterCasing = CharacterCasing.Upper;
            this.txtLay_DD.CheckTextSearched = false;
            this.txtLay_DD.DisabledForeColor = Color.Empty;
            this.txtLay_DD.Font = new Font("Arial", 8.25f);
            this.txtLay_DD.InputMask = "K,C";
            this.txtLay_DD.Location = new Point(0x6c, 0x57);
            this.txtLay_DD.Name = "txtLay_DD";
            this.txtLay_DD.OldValue = null;
            this.txtLay_DD.Size = new Size(0x17, 20);
            this.txtLay_DD.TabIndex = 4;
            this.txtLay_DD.Text = "K";
            this.txtLay_DD.Value = "K";
            this.lblLay_DD0.AutoSize = true;
            this.lblLay_DD0.Font = new Font("Arial", 8.25f);
            this.lblLay_DD0.ForeColor = Color.Blue;
            this.lblLay_DD0.Location = new Point(0x89, 90);
            this.lblLay_DD0.Name = "lblLay_DD0";
            this.lblLay_DD0.Size = new Size(0xbd, 14);
            this.lblLay_DD0.TabIndex = 0x65;
            this.lblLay_DD0.Text = "C-C\x00f3 lấy sản phẩm dở dang, K-Không";
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.CheckDetailMost = true;
            base.ClientSize = new Size(0x31a, 0x1cf);
            base.Name = "FormKTH03EViewer";
            base.rptContainer.Panel1.ResumeLayout(false);
            base.rptContainer.Panel1.PerformLayout();
            base.rptContainer.ResumeLayout(false);
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        protected override void OnGenerateColumns()
        {
            object[][] objArray = new object[7][];
            object[] objArray2 = new object[4];
            objArray2[0] = "Ma_Sp";
            objArray2[1] = "Sản phẩm";
            objArray2[2] = "C";
            objArray[0] = objArray2;
            object[] objArray3 = new object[4];
            objArray3[0] = "Ten_Sp";
            objArray3[1] = "Tên sản phẩm";
            objArray3[2] = "D";
            objArray[1] = objArray3;
            object[] objArray4 = new object[4];
            objArray4[0] = "Dvt";
            objArray4[1] = "Đơn vị tính";
            objArray4[2] = "D";
            objArray[2] = objArray4;
            objArray[3] = new object[] { "So_LuongSP", "Số lượng hoàn thành", "N", AppInstance.TextNumericFormat.Quantity };
            objArray[4] = new object[] { "So_Luong", "Số lượng ti\x00eau hao", "N", AppInstance.TextNumericFormat.Quantity };
            objArray[5] = new object[] { "Gia", "Đơn giá", "N", AppInstance.TextNumericFormat.LocalPrice };
            objArray[6] = new object[] { "Tong_Tien", "Thành tiền", "N", AppInstance.TextNumericFormat.LocalAmount };
            base.LocalColNames = objArray;
            base.OnGenerateColumns();
        }

        protected override void OnMakeReport()
        {
            AppInstance.StartWorkingDate = (DateTime) this.txtNgay_Ct1.Value;
            AppInstance.EndWorkingDate = (DateTime) this.txtNgay_Ct2.Value;
            base.LocalTable = new ReportDataAccess().KTH03E_Get(AppInstance.Subsidiaries, this.txtNgay_Ct1.Value, this.txtNgay_Ct2.Value, this.txtMa_Sp_Me.Value, this.txtMa_Sp.Value, this.txtKieu_BC.Value, this.txtKieu_Gia.Value, this.txtLay_DD.Value, AppInstance.DefLanguage);
            base.OnMakeReport();
        }

        protected override void OnSendParameters()
        {
            base.StimulReport["Ngay"] = "Từ ngày " + string.Format("{0:dd/MM/yyyy}", this.txtNgay_Ct1.Value) + " đến ngày " + string.Format("{0:dd/MM/yyyy}", this.txtNgay_Ct2.Value);
            if (!string.IsNullOrEmpty(this.txtMa_Sp_Me.Value.ToString()))
            {
                base.StimulReport["CongDoan"] = string.Concat(new object[] { "Công đoạn: ", this.txtMa_Sp_Me.Value, " - ", this.txtTen_Sp_Me.Value });
            }
            if (!string.IsNullOrEmpty(this.txtMa_Sp.Value.ToString()))
            {
                base.StimulReport["SanPham"] = string.Concat(new object[] { "Sản phẩm: ", this.txtMa_Sp.Value, " - ", this.txtTen_Sp.Value });
            }
        }
    }
}

